import { API } from 'config'
/**
 * 只支持传入一个参数 payload 多个参数可采用数组/对象解构来处理
 * @param type
 * @returns {function({commit: *}, ...[*]): *}
 */
const makeAction = function (type) {
  return ({commit}, ...args) => commit(type, ...args)
}

/**
 * 首页
 * @type {string}
 */
export const WE_CHAT_SHOW = 'WE_CHAT_SHOW'
export const WE_CHAT_HIDE = 'WE_CHAT_HIDE'
export const TOGGLE_NAV = 'TOGGLE_NAV'
export const showMyWeChat = makeAction(WE_CHAT_SHOW)

export const closeMyWeChat = makeAction(WE_CHAT_HIDE)
//首页切换导航
export const toggleNav = makeAction(TOGGLE_NAV)

/**
 * 投保页面
 * @type {string}
 */
export const TOGGLE_BENEFNO = 'TOGGLE_BENEFNO'
export const SHOW_TELTIPS = 'SHOW_TELTIPS'
export const HIDE_TELTIPS = 'HIDE_TELTIPS'
export const TOGGLE_AGREEMENT = 'TOGGLE_AGREEMENT'
export const TOGGLE_APPLY = 'TOGGLE_APPLY'

//切换身故受益人
export const benefnoToggle = makeAction(TOGGLE_BENEFNO)
//显示验证手机提示
export const showTelTips = makeAction(SHOW_TELTIPS)
//隐藏验证手机提示
export const hideTelTips = makeAction(HIDE_TELTIPS)
//切换本人已阅读..
export const agreementToggle = makeAction(TOGGLE_AGREEMENT)
//切换若本人申请..
export const applyToggle = makeAction(TOGGLE_APPLY)